extends NodeState


var recover_time: float


var player: Player:
	get:
		return state_matchine.root as Player


func _on_process(delta : float) -> void:
	process_animation()
	process_recover(delta)



func _on_enter(_data: NodeStateData) -> void:
	recover_time = player.duration_recover


func _on_exit() -> void:
	pass



func process_animation():
	player.animation_player.play(Player.ANIMATION_RECOVER)


func process_recover(delta : float):
	if recover_time > 0.0:
		recover_time -= delta
		return
	if not player.input_manager.is_movement():
		transition_state(Player.STATE_IDLE)
	else:
		transition_state(Player.STATE_RUN)
